﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agr.CQRS.Domain.Commands;

namespace Agr.Questionnaire.Core.Domain.Qnnaire.Commands
{
    public class RenameQuestionnaire : Command
    {
        public string Name { get; set; }
    }

    internal class RenameQuestionnaireHandler : CommandHandler<RenameQuestionnaire>
    {
        protected override void ExecuteInternal(RenameQuestionnaire command)
        {
            var q = GetById<Questionnaire>(command.AffectedAggregateRootId, command.AffectedVersion);
            q.UseName(command.Name);
        }
    }

}
